Skip to content

feat(Badge): support a contextual help - #3049

Merged
Lisa18289 merged 9 commits into
nextfrom
claude/badge-button-after-text-0e8248
Sep 2, 2026
Merged

feat(Badge): support a contextual help#3049
Lisa18289 merged 9 commits into
nextfrom
claude/badge-button-after-text-0e8248

Conversation

@Lisa18289

@Lisa18289 Lisa18289 commented Sep 1, 2026

Copy link
Copy Markdown
Member

A ContextualHelp in the badge content renders at the end of the badge, shaped and colored like the onClose icon. With both, the close icon stays rightmost. The badge supplies the trigger button, so a consumer writes only the help:

<Badge>
  <Label>Priorität</Label>
  <Text>Hoch</Text>
  <ContextualHelp></ContextualHelp>
</Badge>

That is the pattern ListItemView already uses for ContextMenu: a props context tunnels the overlay to a slot at the end and wraps it with the button via wrapWith.

Verification: browser tests cover that the help opens from the badge's own button and that a disabled badge disables it. The Badge colors visual scenario carries the button through every color and both themes, in the Local and the Remote environment.

🤖 Generated with Claude Code

@Lisa18289 Lisa18289 self-assigned this Sep 1, 2026
@Lisa18289 Lisa18289 added the update-screenshots Label a PR to update the screenshots used for visual regression testing label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./packages/components/

Status Category Percentage Covered / Total
🔵 Lines 78.69% 746 / 948
🔵 Statements 78.57% 763 / 971
🔵 Functions 80.09% 165 / 206
🔵 Branches 70.33% 377 / 536
File CoverageNo changed files found.
Generated in workflow #6495 for commit 380c730 by the Vitest Coverage Report Action

@github-actions github-actions Bot removed the update-screenshots Label a PR to update the screenshots used for visual regression testing label Sep 1, 2026
@Lisa18289
Lisa18289 force-pushed the claude/badge-button-after-text-0e8248 branch from 900bd51 to 380c730 Compare September 1, 2026 09:46
@Lisa18289
Lisa18289 changed the base branch from main to next September 1, 2026 09:46
@Lisa18289
Lisa18289 force-pushed the claude/badge-button-after-text-0e8248 branch from 380c730 to 6dd9054 Compare September 1, 2026 09:52
A Button, CopyButton, Action, ContextualHelpTrigger or ModalTrigger in the
badge content is moved to the end of the badge and rendered like the onClose
icon. With both, the close icon stays rightmost.

Triggers move along with their button — a button tunneled out on its own mounts
outside the trigger and loses its press behavior.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Lisa18289
Lisa18289 force-pushed the claude/badge-button-after-text-0e8248 branch from 6dd9054 to f340da9 Compare September 1, 2026 09:53
@Lisa18289 Lisa18289 added the update-screenshots Label a PR to update the screenshots used for visual regression testing label Sep 1, 2026
@github-actions github-actions Bot removed the update-screenshots Label a PR to update the screenshots used for visual regression testing label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

Preview environments are ready:

Type URL
docs pr-3049.docs.review.flow-components.de
storybook pr-3049.storybook.review.flow-components.de

Images:

  • docs: ghcr.io/mittwald/flow/docs:pr-3049
  • storybook: ghcr.io/mittwald/flow/storybook:pr-3049

@Lisa18289 Lisa18289 added the update-screenshots Label a PR to update the screenshots used for visual regression testing label Sep 1, 2026
@github-actions github-actions Bot removed the update-screenshots Label a PR to update the screenshots used for visual regression testing label Sep 1, 2026
github-actions Bot and others added 3 commits September 1, 2026 11:11
Co-authored-by: Lisa18289 <84317589+Lisa18289@users.noreply.github.com>
The badge does not remove itself — onClose renders the X and calls the handler,
which decides what happens.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The two cases that carry the feature — a button after the text, with and
without the close icon — move into "Badge colors", so every color and both
alpha variants cover them. Drops the separate "Badge actions" scenario.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Lisa18289 Lisa18289 added the update-screenshots Label a PR to update the screenshots used for visual regression testing label Sep 1, 2026
@github-actions github-actions Bot removed the update-screenshots Label a PR to update the screenshots used for visual regression testing label Sep 1, 2026
github-actions Bot and others added 4 commits September 1, 2026 11:55
Co-authored-by: Lisa18289 <84317589+Lisa18289@users.noreply.github.com>
Matches the "Mit Button" section it sits under.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The screenshots cover what the trailing button looks like and where it sits, in
every color. What is left asserts the wiring: a button leaves the content, and
action, modal and contextual help still fire from inside the badge.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
WithContextualHelp shows the trailing button; the close icon has its own story.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Lisa18289
Lisa18289 marked this pull request as ready for review September 1, 2026 12:09
@Lisa18289
Lisa18289 requested a review from a team September 1, 2026 12:09
@mfal

mfal commented Sep 2, 2026

Copy link
Copy Markdown
Member

Scope: contextual help, not buttons in general

Agreed with Lisa that this extension is not about general button support in a badge — it is about supporting ContextualHelp.

So I would rather reuse the known pattern from ListItem + ContextMenu and move from

<Badge>
  <Label>Priorität</Label>
  <Text>Hoch</Text>
  <ContextualHelpTrigger subject="Priorität">
    <Button />
    <ContextualHelp>
      <Text>Tickets mit hoher Priorität werden zuerst bearbeitet.</Text>
    </ContextualHelp>
  </ContextualHelpTrigger>
</Badge>

to

<Badge>
  <Label>Priorität</Label>
  <Text>Hoch</Text>
  <ContextualHelp>
    <Text>Tickets mit hoher Priorität werden zuerst bearbeitet.</Text>
  </ContextualHelp>
</Badge>

ListItemView already does exactly this for ContextMenu: its props context wraps the menu with the trigger button (wrapWith: <OptionsButton …/>), so the consumer writes only the menu and the item supplies the button.

That API expresses precisely what is supported here: contextual help. Generic Button support does include contextual help, but only that part is wanted — and the API should say so.

A ContextualHelp in the badge content is placed at the end of the badge, and
the badge supplies the trigger button — so the consumer writes only the help,
the pattern ListItemView already uses for ContextMenu.

Button, CopyButton, Action and ModalTrigger are no longer tunneled: contextual
help is what this supports, and the API now says so.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Lisa18289 Lisa18289 changed the title feat(Badge): support a button after the text feat(Badge): support a contextual help Sep 2, 2026
@Lisa18289

Copy link
Copy Markdown
Member Author

Done — the badge now takes a ContextualHelp directly and supplies the trigger button itself, following ListItemView + ContextMenu (props context tunnels the overlay to the slot at the end, wrapWith adds the button):

<Badge>
  <Label>Priorität</Label>
  <Text>Hoch</Text>
  <ContextualHelp></ContextualHelp>
</Badge>

Button, CopyButton, Action and ModalTrigger are no longer tunneled, and docs, story, browser and visual tests follow the short form. The visual baselines stayed as they were — the short form renders pixel-identical.

One consequence worth naming: the trigger's subject is no longer reachable, so the button's accessibility label is the generic "More information" rather than "More information about Priorität". ContextualHelpProps (Omit<PopoverProps, "withTip">) has no equivalent, so making it badge-specific would mean extending ContextualHelp itself. Good enough for now, or should we follow up on that?

@Lisa18289
Lisa18289 merged commit d63100a into next Sep 2, 2026
29 of 34 checks passed
@Lisa18289
Lisa18289 deleted the claude/badge-button-after-text-0e8248 branch September 2, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants